import { process } from 'gremlin'

/**
 * Connection to gremlin server.
 *
 * @category Database
 */
export class GremlinConnection {
    source: process.GraphTraversalSource<process.GraphTraversal>
    connectionStrig: string
    /**
     * @param connectionString e.g. ws://localhost:8182/gremlin
     */
    constructor(connectionString: string) {
        this.connectionStrig = connectionString
        const gremlin = require('gremlin');
        const traversal = gremlin.process.AnonymousTraversalSource.traversal;
        const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
        const connection = new DriverRemoteConnection(connectionString)
        this.source = traversal().withRemote(connection)
    }
}
